import React from 'react'
// ===================================================================== Temp
import SearchForm from '#cpt/temp/SearchForm'
import Table from '#cpt/temp/Table'
// ===================================================================== global declare
const { $fn, $Lazy } = window
// ===================================================================== $Lazy
const Page = $Lazy.load(()=>import('#tp/page/page-container'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		// 搜索表单列表
		forms : [
			{ label: '标箱号',		name: 'box_num' },
			{ label: '标本条码',		name: 'spec_code' },
			{ label: '接收人',		name: 'receive_user'},
			{ label: '接收时间',		names: ['start_date','end_date'], 	type:'date-range', 	loading:true },
		],
	}	
	componentDidMount(){
		if(window.isInit){
			this.fetch()
		}
	}
	// paging
	fetch = () => $fn.fetch.call(this,'sp-box-receive-log/index')
	
	// 表单
	cols = [
		{ title: '标箱编码', 		dataIndex: 'box_num', 				...$fn.table.spec_code },
		{ title: '标箱条码', 		dataIndex: 'box_code', 				...$fn.table.spec_code },
		{ title: '录入总标本数', 	dataIndex: 'spec_num_total', 		width:100 },
		{ title: '接收总标本数', 	dataIndex: 'receive_count', 		width:100 },
		{ title: '开箱温度', 		dataIndex: 'warm', 					width:100 },
		{ title: '标本条码', 		dataIndex: 'spec_code', 			...$fn.table.spec_code },
		{ title: '条码标本数', 		dataIndex: 'spec_num', 				width:100	 },
		{ title: '接收人', 			dataIndex: 'receive_user', 			width:100	 },
		{ title: '接收时间', 		dataIndex: 'created_at',  			...$fn.table.time},
	]
	
	render(){
		return (
			<Page title='标本箱接收记录'>
				{/* 搜索 */}
				{ SearchForm.call(this) }
				{/* 表格 */}
				{ Table.call(this, { isInit: window.isInit }) }
			</Page>
		)
	}
}

export default Index